package com.zhuoli.service.springboot.dubbo.consumer.core.impl;

import com.zhuoli.service.springboot.dubbo.consumer.common.request.SayHelloConsumerRequest;
import com.zhuoli.service.springboot.dubbo.consumer.common.vo.SayHelloConsumerVo;
import com.zhuoli.service.springboot.dubbo.consumer.core.HelloControllerService;
import com.zhuoli.service.springboot.dubbo.contract.request.SayHelloRequest;
import com.zhuoli.service.springboot.dubbo.contract.service.DubboTestService;
import com.zhuoli.service.springboot.dubbo.contract.vo.SayHelloVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @Author: zhuoli
 * @Date: 2018/8/22 10:34
 * @Description:
 */
@Service
@AllArgsConstructor
public class HelloControllerServiceImpl implements HelloControllerService {

    private DubboTestService dubboTestService;

    @Override
    public SayHelloConsumerVo sayHello(SayHelloConsumerRequest request) {
        SayHelloRequest sayHelloRequest = new SayHelloRequest();
        sayHelloRequest.setContent(request.getContent());
        SayHelloVo sayHelloVo = dubboTestService.sayHello(sayHelloRequest);

        SayHelloConsumerVo sayHelloConsumerVo = new SayHelloConsumerVo();
        sayHelloConsumerVo.setResult(sayHelloVo.getResult());
        return sayHelloConsumerVo;
    }
}
